<template>
  <div class="DataStatistics">
    <el-card style="margin: 20px">
      <div class="productBtm">
        <!-- 号码数据 -->
        <el-table :data="productData.data" stripe border style="width: 100%">
          <el-table-column prop="createTime" label="创建时间" align="center">
          </el-table-column>
          <el-table-column prop="ip" label="IP" align="center">
          </el-table-column>
          <el-table-column
            prop="successConsume"
            label="消费（元）"
            align="center"
          >
          </el-table-column>
          <el-table-column prop="allCount" label="请求总数" align="center">
          </el-table-column>
          <el-table-column label="正常号码" align="center">
            <template slot-scope="scope">
              {{ scope.row.allCount - scope.row.successCount }}
            </template>
          </el-table-column>
          <el-table-column label="正常比例" align="center">
            <template slot-scope="scope">
              {{
                (
                  ((scope.row.allCount - scope.row.successCount) /
                    scope.row.allCount) *
                  100
                ).toFixed(2)
              }}%
            </template>
          </el-table-column>
          <el-table-column prop="successCount" label="风险号码" align="center">
          </el-table-column>
          <el-table-column label="风险比例" align="center">
            <template slot-scope="scope">
              {{
                ((scope.row.successCount / scope.row.allCount) * 100).toFixed(
                  2
                )
              }}%
            </template>
          </el-table-column>
          <el-table-column prop="username" label="操作人" align="center">
          </el-table-column>
        </el-table>
      </div>
    </el-card>
  </div>
</template>

<script>
import { getProduct } from "@/api/log";
export default {
  created() {
    this.getProductDatan();
  },
  data() {
    return {
      productData: {},
    };
  },
  methods: {
    async getProductDatan() {
      let res = await getProduct();
      if (res.code == 200) {
        this.$message({
          message: "查询成功",
          type: "success",
        });
        this.productData = res;
      }
      console.log(this.productData);
    },
  },
};
</script>

<style></style>
